<?php

use yii\helpers\Html;
use kartik\builder\Form;
use kartik\form\ActiveForm;
use kartik\tabs\TabsX;
/**
 * @var yii\web\View $this
 * @var common\models\Member $model
 * @var yii\widgets\ActiveForm $form
 */

?>

<div class="member-form">

    <?php
    $form = ActiveForm::begin([
        'type'       => ActiveForm::TYPE_VERTICAL,
        'formConfig' => ['labelSpan' => 2, 'deviceSize' => ActiveForm::SIZE_SMALL],
    ]);

    ?>


    <div class="">
        <?php $this->beginBlock('main'); ?>

        <?php
        echo Form::widget([
            'model'       => $model,
            'form'        => $form,
            'columns'     => 2,
            'compactGrid' => true,
            'attributes'  => [
                'member_name'     => ['type' => Form::INPUT_TEXT],
                'member_password' => ['type' => Form::INPUT_PASSWORD],
                'member_email'    => ['type' => Form::INPUT_TEXT],
                'member_sex'      => ['type' => Form::INPUT_RADIO_LIST, 'items' => [true => '女', false => '男'], 'options' => ['inline' => true]],
                'member_truename' => ['type' => Form::INPUT_TEXT],
                'member_points'   => ['type' => Form::INPUT_TEXT],
                'member_state'    => [
                    'type'    => Form::INPUT_RADIO_LIST,
                    'items'   => ['激活', '删除'],
                    'options' => ['inline' => true]
                ],
                'member_birthday' => ['type' => Form::INPUT_TEXT],
                'member_avatar'   => ['type'    => Form::INPUT_WIDGET, 'widgetClass' => '\kartik\file\FileInput',
                                      'options' => [
                                          'pluginOptions' => [
                                              'showCaption'        => false,
                                              'showBrowse'         => false,
                                              'dropZoneTitle'      => '这里',
                                              'browseOnZoneClick'  => true,
                                              'dropZoneClickTitle' => 'test'
                                          ]
                                      ]
                ],
            ]
        ]);
        ?>
        <?php $this->endBlock(); ?>



        <?php $this->beginBlock('logs'); ?>
        logs
        <?php $this->endBlock(); ?>

        <?=
        TabsX::widget(
            [
                'encodeLabels' => false,
                'items'        => [
                    [
                        'label'   => Yii::t('models', 'Member'),
                        'content' => $this->blocks['main'],
                        'active'  => true,
                    ],
                    [
                        'label'   => Yii::t('models', 'logs'),
                        'content' => $this->blocks['logs'],
                    ],
                ]
            ]
        );
        ?>
        <hr/>

        <?php echo $form->errorSummary($model); ?>

        <?= Html::submitButton(
            '<span class="glyphicon glyphicon-check"></span> ' .
            ($model->isNewRecord ? 'Create' : 'Save'),
            [
                'id'    => 'save-' . $model->formName(),
                'class' => 'btn btn-success'
            ]
        );
        ?>

        <?php ActiveForm::end(); ?>

    </div>

</div>

